// 重置按钮
<script>
export default {
    name: 'TheResetBtn',
    functional: true,
    props: {
        params: {
            type: Object,
            default () {
                return {}
            }
        },
        // 初始状态下的params
        initParams: {
            type: Object,
            require: true
        },
        // 自定义重置后置函数
        afterReset: {
            type: Function,
        }
    },
    render(h, context) {
        const { params, initParams, afterReset } = context.props

        return h('el-button', {
            on: {
                click: () => {
                    Object.assign(params, initParams)
                    if (afterReset && typeof afterReset === 'function') {
                        afterReset.call(context.parent)
                    }
                }
            }
        }, '重置')
    }
}
</script>